// BaseDialog.cpp : implementation file
//

#include "stdafx.h"
#include "mfc_test3.h"
#include "BaseDialog.h"

using namespace std;

// CBaseDialog dialog

IMPLEMENT_DYNAMIC(CBaseDialog, CDialog)

CBaseDialog::CBaseDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CBaseDialog::IDD, pParent)
{

}

CBaseDialog::~CBaseDialog()
{
}

void CBaseDialog::DoDataExchange(CDataExchange* pDX)
{
  CDialog::DoDataExchange(pDX);
  DDX_Control(pDX, IDC_LIST1, m_conListCtrl);
}


BEGIN_MESSAGE_MAP(CBaseDialog, CDialog)
  ON_NOTIFY(LVN_GETDISPINFO, IDC_LIST1, OnGetdispinfoList)
  ON_WM_TIMER()
END_MESSAGE_MAP()

//This function is called when the list needs data. This is the most
//critical function when working with virtual lists.
void CBaseDialog::OnGetdispinfoList(NMHDR* pNMHDR, LRESULT* pResult) 
{
  LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;

  //Create a pointer to the item
  LV_ITEM* pItem= &(pDispInfo)->item;

  //Which item number?
  int itemid = pItem->iItem;

  //Do the list need text information?
  if (pItem->mask & LVIF_TEXT)
  {
    CString text;

    ////Which column?
    //if(pItem->iSubItem == 0)
    //{
    //  //Text is name
    //  text = m_database[itemid].m_name;
    //}
    //else if (pItem->iSubItem == 1)
    //{
    //  //Text is slogan
    //  text = m_database[itemid].m_slogan;
    //}

    ////Copy the text to the LV_ITEM structure
    ////Maximum number of characters is in pItem->cchTextMax
    //lstrcpyn(pItem->pszText, text, pItem->cchTextMax);
  }

  *pResult = 0;
}


// CBaseDialog message handlers

void CBaseDialog::OnTimer(UINT_PTR nIDEvent)
{
  // TODO: Add your message handler code here and/or call default
  RunTimer();

  CDialog::OnTimer(nIDEvent);
}

BOOL CBaseDialog::OnInitDialog()
{
  CDialog::OnInitDialog();

 // ListView_SetExtendedListViewStyle(m_conListCtrl.m_hWnd, LVS_EX_FULLROWSELECT );

  // TODO:  Add extra initialization here
 // SetTimer(1, 1000, NULL);

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}

void CBaseDialog::RunTimer()
{
  //m_database.push_back(NULL);

  //m_conListCtrl.SetItemCount(m_database.size());
}